import useDialog from "../hooks/useDialog";

export default function PopupDemo() {
  const [dialogJSX, openDialog, closeDialog] = useDialog({
    title: "哥的窗窗",
    content: (
      <div>
        <h1>重磅消息！！！</h1>
        <p>你老婆跟人跑了~~~</p>
      </div>
    ),
    onConfirm: () => console.log("哦"),
  });

  return (
    <div>
      <h3>PopupDemo</h3>
      <button
        onClick={() => {
          openDialog();
          setTimeout(() => {
            closeDialog();
          }, 5000);
        }}
      >
        显示弹窗
      </button>

      {/* 弹窗JSX */}
      {dialogJSX}
    </div>
  );
}
